import java.io.FileReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.*;
import java.io.*;


public class ReadPNMGeometry{
	
	public static java.util.List <Pore>listOfPores = new ArrayList<Pore>();

	public static Map<Integer,Pore>listOfPoresHash = new HashMap<Integer,Pore>();

	public static void readfile(String file){
		try{
			FileReader fr = new FileReader(file);
			BufferedReader bf=new BufferedReader(fr);
			String str = null;

			//String[] strs = str.split("");
			String str_int="";

			int ch = 0;
			int IndexOfDigi;
			int StartIndex;
			String[] NumsFromFile;

			while ((str=bf.readLine())!=null){
				//str = bf.readLine();
				System.out.println(str+"    ORIGINAL STRING\r");

			StartIndex=1;
			//IndexSpace=str.indexOf(" ",StartIndex);
			NumsFromFile = str.split(" +");
			System.out.println(NumsFromFile.length+"	@@@@@@    "+Integer.parseInt(NumsFromFile[2]));
			Pore poreFromFile = new Pore(NumsFromFile.length);
				for (int i=0;i<NumsFromFile.length;i++)
					poreFromFile.NeiThroutIndex[i]=Integer.parseInt(NumsFromFile[i]);
			
			//listOfPores.add(poreFromFile);
			listOfPoresHash.put(poreFromFile.NumOfNeighbours,poreFromFile);

			}

			bf.close();
		}catch(IOException e){
			e.printStackTrace();

		}
			
		//bf.close();
	}


	//===============================================================================
	public List<Pore> getNodeList()
           {
             return listOfPores;
           }



//==================================================================================
	public static void main(String[] args){
		readfile("./testf1.txt");

		
		System.out.println("-----------------------------");

		//-------------------------------------------------------------
		//Iterator<Pore> it=listOfPores.iterator();
		//while(it.hasNext()){
		//	//Object lspore = it.next();
		//	System.out.println(it.next().NumOfNeighbours);
		//}
		


		//-------------------------------------------------------------
		//for (Pore ipos:listOfPores)
		//	System.out.println(ipos.NumOfNeighbours);	



		//--------------------------------------------------------------
		//System.out.println(listOfPoresHash.get(5).NumOfNeighbours);
		


		//---------------------------------------------------------------
		/*
		Iterator<Integer> iter = listOfPoresHash.keySet().iterator();
		while (iter.hasNext())
			{
				int key = iter.next();
				System.out.println(key);



			}
		*/


		//-------------------------------------------------------------------
		/*
		for (int key : listOfPoresHash.keySet()) {
				
			System.out.println(listOfPoresHash.get(key).NeiThroutIndex[1]);	
			    //value = map.get(key);

		}
		*/


		//------------------------------------------------------------------------
		/*
		Iterator<Map.Entry<Integer, Pore>> iter = listOfPoresHash.entrySet().iterator();
		while (iter.hasNext()) {
    			Map.Entry<Integer,Pore> entry = iter.next();
    			//Object key = entry.getKey();
    			//Object val = entry.getValue();
			//System.out.println(entry.getKey());
			System.out.println(entry.getKey()+"   "+entry.getValue().NeiThroutIndex[0]);

			} 
		*/


		//-----------------------------------------------------------------
		for (Map.Entry<Integer,Pore> entry : listOfPoresHash.entrySet())
			{
				System.out.println(entry.getKey()+"   "+entry.getValue().NeiThroutIndex[0]);
			}

		

	}
}


//-------------------------------------------------------------------------------------
/*
	public class ParameterFromPore1{
	
	protected int NumsOfConnects;
	






	}
*/
